package com.ticket.sass.common.entity.tenant;

import com.baomidou.mybatisplus.annotation.*;
import com.ticket.sass.common.entity.tenant.enums.PriceSchemeMemberPriceType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author ywb
 * @since 2024-03-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("price_scheme_member_prices")
@ApiModel(value="PriceSchemeMemberPricesEntity对象", description="")
public class PriceSchemeMemberPriceEntity implements Serializable {
    @ApiModelProperty(value = "票价方案会员价ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "会员级别ID")
    private Long memberLevelId;

    @ApiModelProperty(value = "折扣类型：1 立减，2 折扣，3 固定")
    private PriceSchemeMemberPriceType type;
    
    @ApiModelProperty(value = "首单享受")
    private Boolean firstEnable;
    
    @ApiModelProperty(value = "折扣值")
    private BigDecimal value;

    @ApiModelProperty(value = "票价方案ID")
    private Long priceSchemeId;

    @ApiModelProperty(value = "租户ID")
    private Long tenantId;
    
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    public LocalDateTime createdAt;
    
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public LocalDateTime updatedAt;
    
    @TableField(select = false)
    @ApiModelProperty(value = "删除时间")
    @TableLogic(value = "null", delval = "now()")
    public LocalDateTime deletedAt;
    
    @TableField(value = "member_level_name", exist = false)
    public String memberLevelName;
    
    
    public PriceSchemeMemberPriceEntity() {
    }
    
    public PriceSchemeMemberPriceEntity(Long memberLevelId, Long priceSchemeId) {
        this.memberLevelId = memberLevelId;
        this.priceSchemeId = priceSchemeId;
    }
    
    public PriceSchemeMemberPriceEntity(Long memberLevelId, PriceSchemeMemberPriceType type, Boolean firstEnable, BigDecimal value, Long priceSchemeId) {
        this.memberLevelId = memberLevelId;
        this.type = type;
        this.firstEnable = firstEnable;
        this.value = value;
        this.priceSchemeId = priceSchemeId;
    }
}
